Imports System.Data
Partial Class Admin_frmTabShippingCharge
    Inherits System.Web.UI.Page
    Dim conn As New SqlString()
    Dim _BO As New Bo()
    Dim _ShippingChargeVO As New ShippingChargeVo()
    Dim _EmployeeId As String
    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Try
            _ShippingChargeVO.ShippingChargeId = txtShippingChargeId.Text
            _ShippingChargeVO.Charge = txtCharge.Text

            _BO.InsertShippingCharge(_ShippingChargeVO)
            ClearAll()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub
    Public Sub ClearAll()
        txtShippingChargeId.Text = ""
        txtCharge.Text = ""

        MsgBox("ShippingCharge inserted")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        _EmployeeId = Session("EmpId")
        If _EmployeeId = "" Then
            Response.Redirect("../Client/frmLogin.aspx")
        End If
        If Not Page.IsPostBack Then
            panel2.Visible = False
            panel4.Visible = False
            GridData()
        End If
    End Sub
    Sub GridData()
        Dim dtShippingCharge As DataTable
        dtShippingCharge = _BO.getShippingChargeDetails()
        gdShippingCharge.DataSource = dtShippingCharge
        gdShippingCharge.DataBind()
    End Sub
    Protected Sub gdShippingCharge_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles gdShippingCharge.EditCommand
        Session("EmpId") = _EmployeeId
        Response.Redirect("frmModifyShippingCharge.aspx?ShippingChargeId=" & e.Item.Cells(0).Text)
    End Sub
    Protected Sub gdShippingCharge_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles gdShippingCharge.DeleteCommand
        _BO.DeleteShippingCharge(e.Item.Cells(0).Text)
        Response.Redirect("frmTabShippingCharge.aspx")
    End Sub
    Protected Sub ImageAdd_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageAdd.Click
        panel2.Visible = True
        panel4.Visible = False

    End Sub

    Protected Sub ImageEdit_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageEdit.Click
        panel2.Visible = False
        panel4.Visible = True
        GridData()
    End Sub
    Protected Sub gdShippingCharge_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles gdShippingCharge.PageIndexChanged
        gdShippingCharge.CurrentPageIndex = e.NewPageIndex
        GridData()
    End Sub

    Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
        txtShippingChargeId.Text = ""
        txtCharge.Text = ""
    End Sub
End Class
